package com.qingcheng.controller.order;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.service.goods.AutoAddDataToRedisService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

/**
 * Welcome to the most Amazing IntelliJ IIIDEA.
 * Creat0r: ^_^ fffantianxing ^_^
 * Date: 2019-07-10
 * Time: 21:40
 */
@Controller
public class AutoAddBrandAndSpecToRedis {

    @Reference
    private AutoAddDataToRedisService autoAddDataToRedisService;

//    @Scheduled(cron = "0 0 0/3 * * ? *")
    @Scheduled(cron = "0 0 0-5 * * ? ")
    public void AutoAddDataToRedis(){
        autoAddDataToRedisService.addAllBrandsToRedis();
        System.out.println("所有brand添加到了缓存！");
    }

    @Scheduled(cron = "0 0 0-4 * * ? ")
    public void AutoAddSpecToRedis(){
        autoAddDataToRedisService.addAllSpecToRedis();
        System.out.println("所有spec添加到了缓存！");
    }
}
